import request from '@/utils/request'

//添加角色
export function addRoleApi(name){
    // name json 角色对象
   return request({
    method:'post',
    url:'/role/add',
    data: name
   })
}

//删除角色
export function delRoleApi(roleId){
    //roleId integer 角色ID
    return request({
     method:'delete',
     url:'/role/delete',
     params:{
      "roleId":roleId
     }
    })
 }

 //查找所有角色
export function selectRoleApi(page){
    //page integer 页数, 默认为0
    return request({
     method:'get',
     url:'/role/find',
     params:{
      "page":page
     }
    })
 }
 //修改角色
 export function updateRoleApi(role){
    return request({
     method:'post',
     url:'/role/update',
     data:role
    })
 }
 //修改用户角色
 export function updateUserRoleApi(userId,roleId,type){ 
    return request({
     method:'post',
     url:'/role/update/user',
     params:{
      "userId":userId,
      "roleId":roleId,
      "type":type
     }
    })
 }